//
// Created by 束庆乐 on 2024/12/31.
//
#include "iostream"
using namespace std;

class Building;
class GoodGay{
private:
    Building* building;
public:
    GoodGay();
    void visit();//只让visit()作为Building的好朋友，可以访问Building中私有内容
    void visit2();
};
class Building{
    //GoodGay中的visit成员函数是Building的好友，可以访问私有内容
    friend void GoodGay::visit();
private:
    string bedroom;
public:
    string sitroom;
    Building();
};

Building::Building() {
    this->sitroom = "sitroom";
    this->bedroom = "bedroom";
}
GoodGay::GoodGay() {
    building = new Building();
}

void GoodGay::visit() {
    cout << building->bedroom << endl;
    cout << building->sitroom << endl;
}
void GoodGay::visit2() {
    cout << building->sitroom << endl;
}

void test(){
    GoodGay gg;
    gg.visit();
    gg.visit2();
}

int main071(){
    test();

    return 0;
}
